package com.dtx.dao;

import com.dtx.domain.HExam;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

public interface IHExamDao {
    @Select("select * from highexam where flag=1")
    List<HExam> findAllHExam() throws Exception;

    @Select("select * from highexam where flag=1 and id = #{id}")
    HExam findHExamById(Integer id) throws Exception;

    @Insert("insert into highexam(name,xA,xB,xC,xD,correct,fenlei,zhenti) values(#{name},#{xA},#{xB},#{xC},#{xD},#{correct},#{fenlei},#{zhenti})")
    void saveHExam(HExam hexam) throws Exception;

    @Update("update highexam set flag=0 where id = #{id}")
    void deleteHExamById(Integer id) throws Exception;

    @Update("update highexam set name=#{name},xA=#{xA},xB=#{xB},xC=#{xC},xD=#{xD},correct=#{correct},fenlei=#{fenlei},zhenti=#{zhenti} where id = #{id}")
    void updateHExam(HExam hexam) throws Exception;


    //@Select("select * from exam where name = '%${value}%'")
    @Select("select * from highexam where flag=1 and name like #{name}")
    List<HExam> findHExamByName(String name) throws Exception;
}
